/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * BancoFiltro.java
 *
 * Created on 04/03/2013, 09:43:49
 */
package gui;

import javax.swing.JCheckBox;
import sun.misc.JavaxSecurityAuthKerberosAccess;

/**
 *
 * @author Gabriel
 */
public class DataBaseFilter extends javax.swing.JFrame  {

    /** Creates new form BancoFiltro */
    boolean[] bancos = new boolean[4];

   public boolean getBancoIndex(int index){
       boolean aux;
       try {
           aux = bancos[index];
       } catch (Exception e) {
           aux = true;
       }
       return aux;
   }
    
    public DataBaseFilter() {
       
        initComponents();
     }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        chk4YEAST = new javax.swing.JCheckBox();
        chk3NCBI = new javax.swing.JCheckBox();
        chk1TAIR = new javax.swing.JCheckBox();
        chk2KEGG = new javax.swing.JCheckBox();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Data Base Filter");
        setMinimumSize(new java.awt.Dimension(120, 80));
        getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.LINE_AXIS));

        jPanel2.setMinimumSize(new java.awt.Dimension(250, 100));
        jPanel2.setPreferredSize(new java.awt.Dimension(250, 100));

        jLabel1.setText("Selecione o Bancos:");

        chk4YEAST.setText("YEAST");

        chk3NCBI.setText("NCBI");

        chk1TAIR.setText("TAIR");

        chk2KEGG.setText("KEGG");

        jButton1.setText("Salvar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 250, Short.MAX_VALUE)
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGap(0, 72, Short.MAX_VALUE)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addGap(5, 5, 5)
                            .addComponent(jLabel1))
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addComponent(chk1TAIR)
                            .addGap(3, 3, 3)
                            .addComponent(chk2KEGG))
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addComponent(chk3NCBI)
                            .addComponent(chk4YEAST))
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addGap(21, 21, 21)
                            .addComponent(jButton1)))
                    .addGap(0, 72, Short.MAX_VALUE)))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 106, Short.MAX_VALUE)
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGap(0, 11, Short.MAX_VALUE)
                    .addComponent(jLabel1)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(chk1TAIR)
                        .addComponent(chk2KEGG))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(chk3NCBI)
                        .addComponent(chk4YEAST))
                    .addComponent(jButton1)
                    .addGap(0, 12, Short.MAX_VALUE)))
        );

        getContentPane().add(jPanel2);

        pack();
    }// </editor-fold>//GEN-END:initComponents

   private void setBancos(){
       JCheckBox[] chk = new JCheckBox[4];
       
       chk[0] = chk1TAIR;
       chk[1] = chk2KEGG;
       chk[2] = chk3NCBI;
       chk[3] = chk4YEAST;
       
       for (int i = 0; i < chk.length; i++) {
           if (chk[i].isSelected()) {
               bancos[i] = true;
           } else {
               bancos[i] = false;
           }
       }

     
   }
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    setBancos();
}//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(DataBaseFilter.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(DataBaseFilter.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(DataBaseFilter.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(DataBaseFilter.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new DataBaseFilter().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox chk1TAIR;
    private javax.swing.JCheckBox chk2KEGG;
    private javax.swing.JCheckBox chk3NCBI;
    private javax.swing.JCheckBox chk4YEAST;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel2;
    // End of variables declaration//GEN-END:variables
}
